using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;

/// <summary>
/// Summary description for AdBus
/// </summary>
public class AdBus
{
    public AdBus() { }

    public DataTable LoadAds()
    {
        return new AdDao().LoadAds();
    }

    public DataTable LoadAllAds()
    {
        return new AdDao().LoadAllAds();
    }

    public Ad GetDto(decimal adID)
    {
        return new AdDao().GetDto(adID);
    }

    public void Delete(Ad dto)
    {
        string path = AppDomain.CurrentDomain.BaseDirectory + @"imgs\ads\" + dto.AdImg;
        if (File.Exists(path)) File.Delete(path);
        new AdDao().Delete(dto.AdID);
    }

    public void Update(Ad dto)
    {
        new AdDao().Update(dto);
    }

    public void Add(Ad dto)
    {
        new AdDao().Add(dto);
    }
}
